﻿/// <reference path="jquery-2.1.4.min.js" />
/// <reference path="createjs.js" />

var bgW = $(window).width();
bgW = 640;
var bgH = $(window).height();

var stage1 = new createjs.Stage("btn_changan");
var dianjiCon = new createjs.Container;
var queue1 = new createjs.LoadQueue();
createjs.Sound.alternateExtensions = ["mp3,wav"];
queue1.installPlugin(createjs.Sound);
var LoadCanvas1 = function() {

	/////////////////////////启动触摸
	createjs.Touch.enable(stage1);
	queue1.loadManifest([
		{id:"img2_close",src:"image2/img2_close.png"},
	], true, "image/");
	queue1.on("progress", function(event) {

		if (queue1.progress.toString().length > 4) {
			progress = queue1.progress.toString().substr(2, 2);
		} else {
			if (queue1.progress.toString().length == 3 || queue1.progress.toString().length == 4) {
				progress = queue1.progress * 100;
			}

			progress = queue1.progress;
		}
		if (progress.toString().indexOf(".") <= 0) {
			if (progress == "00") {
				progress = "0";
			}
			//          baifenbi.text = progress + "%";
			if (progress == "1") {
				progress = "100";
//				$(".loading").css("display", "none");
			}
//			$(".jindutiao").html(progress + "%");
//			console.log(progress);
		}

	});
	queue1.on("complete", handleComplete1, this);
}
//var bg,logo1,logo2;
var handleComplete1 = function() {
//	alert(rukou);
	Load();
	createjs.Ticker.setFPS(60);
	createjs.Ticker.addEventListener("tick", function(event) {
		stage1.update();
	})
}

var Load = function(){
	//var shipin = document.getElementById("video1");
	//shipin.currentTime = 13;
	shipin.addEventListener("ended",function(){
		$(".img1_bg").hide();
		$(".img2_div,.img2_bg1_meng,.img2_bg2_meng").hide();
		$(".img2_bg").show();
		
	})
	stage1.addChild(dianjiCon);
	var shape = new createjs.Shape;
	shape.graphics.beginFill("red").drawRect(0,0,640,200);
	shape.alpha = 0.01;
	dianjiCon.addChild(shape);
	shape.addEventListener("mousedown",function(){
		shipin.play();
//		play();
		console.log("down");
	})
	shape.addEventListener("pressmove",function(){
		console.log("move");
	})
	shape.addEventListener("pressup",function(){
		shipin.pause();
//		stop();
		console.log("up");
	})
}



















































































